"""
Cookie:
三种方法：手动登录之后，拿着登录后的cookie
    --1.全局cookie的设置，settings.py,COOKIES_ENABLED = False, 在DEFAULT_REQUEST_HEADERS添加登录过后的cookie
        为字符串的形式，可以直接复制network当中的
    --2.每一个请求对象，都是不同的，单独设置Cookie,settings.py,COOKIES_ENABLED = True,cookie值不再能使用字符串，而是要以键值对字典的方式存在
    --3.下载器中间件里面去添加cookie


    想要中间件生效，settings里面去进行配置

    User-Agent
    下载器中间件怎么配置

    代理IP

"""



# 复制过来的字符串形式的cookie，如果构造成字典形式的cookie

str_ = '_vwo_uuid_v2=D3EBE0F7503441D3959402C3D71EEFF0B|4519ecc1b3f605c6b3697a14afd4a59b; _ga=GA1.1.313176198.1627969259; _ga_RXNMP372GL=GS1.1.1635228400.1.1.1635228631.0; douban-fav-remind=1; gr_user_id=3fdfb9be-b87a-4cc3-912f-8f8b07904bd0; bid=r1MwGRy5Gt0; ll="118267"; __utmv=30149280.23554; __gads=ID=ef8ce5743fefa86a-221beee43fd6009a:T=1662460703:RT=1662460703:S=ALNI_MbzxKdyJpTlJv1RdcDG0Vl1kAb72g; __yadk_uid=C6KtjJ2f8urRFaZqGTH047G4srljKzDi; __utmz=30149280.1675861616.283.148.utmcsr=baidu|utmccn=(organic)|utmcmd=organic; __utmz=223695111.1675861616.269.136.utmcsr=baidu|utmccn=(organic)|utmcmd=organic; ap_v=0,6.0; __utmc=30149280; __utmc=223695111; __gpi=UID=0000054e17920d2a:T=1652440669:RT=1676284770:S=ALNI_MacE_FArVxgYZLUPPx0fB49PDm03Q; _pk_ref.100001.4cf6=%5B%22%22%2C%22%22%2C1676291660%2C%22https%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DHSJxDDfxwtYFuP8pPMIMK5N0HuSgBgOd_8RQlcCWXH7fc9PY5o1IcN2rmlmt_8PqG-vDxb1kuZU1iN12bHbWPK%26wd%3D%26eqid%3De5b62929000454300000000663e37b1e%22%5D; _pk_ses.100001.4cf6=*; _pk_id.100001.4cf6=831bebd601806517.1627969259.280.1676291837.1676284769.; __utma=30149280.313176198.1627969259.1676284769.1676291837.288; __utmb=30149280.0.10.1676291837; __utma=223695111.400287297.1627969259.1676284769.1676291837.274; __utmb=223695111.0.10.1676291837'

# print(type(str_.split('; ')),str_.split('; '))  #  str_.split('; ') 》<class 'list'>

# dict_ = {}
# for i in str_.split('; '):  # i >> <class 'str'>  索引为0的部分是键值对的键名，而索引为1的部分是键值对的值
#     # print(type(i.split('=',1)),i.split('=',1)) # i.split('=',1) 》<class 'list'>
#     dict_[i.split('=',1)[0]] = i.split('=',1)[1]



dict_ = {i.split('=',1)[0]:i.split('=',1)[1] for i in str_.split('; ')}
print(dict_)

# dict_ = {'_vwo_uuid_v2':'D3EBE0F7503441D3959402C3D71EEFF0B|4519ecc1b3f605c6b3697a14afd4a59b'}